package org.zachary.creditbusiness.commodityandhouse.dto;

import org.zachary.creditbusiness.commodityandhouse.entity.Commodity;
import java.math.BigDecimal;

/**
 * 商品信息加购买次数DTO
 */
public class CommodityWithPurchaseCount {
    private Integer id;
    private String name;
    private BigDecimal price;
    private Integer inventory;
    private String category;
    private String imageUrl;
    private Integer purchaseCount; // 购买次数

    public CommodityWithPurchaseCount() {}

    public CommodityWithPurchaseCount(Commodity commodity, Integer purchaseCount) {
        this.id = commodity.getId();
        this.name = commodity.getName();
        this.price = commodity.getPrice();
        this.inventory = commodity.getInventory();
        this.category = commodity.getCategory();
        this.imageUrl = commodity.getImg();
        this.purchaseCount = purchaseCount;
    }

    // Getter and Setter methods
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getInventory() {
        return inventory;
    }

    public void setInventory(Integer inventory) {
        this.inventory = inventory;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public Integer getPurchaseCount() {
        return purchaseCount;
    }

    public void setPurchaseCount(Integer purchaseCount) {
        this.purchaseCount = purchaseCount;
    }

    @Override
    public String toString() {
        return "CommodityWithPurchaseCount{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", price=" + price +
                ", inventory=" + inventory +
                ", category='" + category + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", purchaseCount=" + purchaseCount +
                '}';
    }
}